STEP 30

NUMERICAL INTEGRATION 1

The trapezoidal rule

It is often either difficult or impossible to evaluate by analytical methods definite integrals of the form

,

so that numerical integration or quadrature must be used.

It is well known that the definite integral may be interpreted as the area under the curve y = f (x) for and may be evaluated by subdivision of the interval and summation of the component areas. This additive property of the definite integral permits evaluation in a piecewise sense. For any subinterval of the interval , we may approximate f (x) by the interpolating polynomial Pn(x). Then we obtain the approximation

,

which will be a good approximation, provided n is chosen so that the error |f (x) - Pn(x)| in each tabular subinterval is sufficiently small. Note that for n > 1 the error is often alternately positive and negative in successive subintervals and considerable cancellation of error occurs; in contrast with numerical differentiation, quadrature is inherently accurate! It is usually sufficient to use a rather low degree, polynomial approximation over any subinterval .

  1. The trapezoidal rule

    Perhaps the most straightforward quadrature is to subdivide the interval into N equal strips of width h by the points

    such that b = a + Nh. Then one can use the additive property

    and the linear approximations, involving

    to obtain the trapezoidal rule, which is suitable for computer implementation (cf. Pseudo-Code

    Integration by the trapezoidal rule therefore involves computation of a finite sum of values of the integrand f, whence it is very quick. Note that this procedure can be interpreted geometrically (Figure 16) as the sum of the areas of N trapezoids of width h and average height (fj + fj+1)/2.

    FIGURE 15 The trapezoidal rule

  2. Accuracy

    The trapezoidal rule corresponds to a rather crude polynomial approximation (a straight line) between successive points xj and xj+1 = xj + h, and hence can only be accurate for sufficiently small h. An approximate (upper) bound on the error may be derived as follows: The Taylor expansion

    yields the trapezoidal form:

    while f (x) may be in xj ? x ? xj+1 as

    to arrive at the exact form:

    Comparison of these two forms shows that the truncation error is

    .

    (STEP 2 regarding the concept of truncation error.) Ignoring higher-order terms, one arrives at an approximate bound on this error when using the trapezoidal rule over N subintervals:

    .

    Whenever possible, we will choose h small enough to make this error negligible. In the case of hand computations from tables, this may not be possible. On the other hand, in a computer program in which f (x) may be generated anywhere in , the interval may be resubdivided until sufficient accuracy is achieved. (The integral value for successive subdivisions can be compared, and the subdivision process terminated when there is adequate agreement between successive values.)

  3. Example

    Obtain an estimate of the integral

    using the trapezoidal rule and the data in STEP 20:. If we use T(h) to denote the approximation with strip width h, we obtain

    Since we may observe that the error sequence -0.00081, -0.00020, -0.00005 decreases with h?, as expected.

    Checkpoint

    1. Why is quadrature using a polynomial approximation for the integrand likely to be satisfactory, even if the polynomial is of low degree?
    2. What is the degree of the approximating polynomial corresponding to the trapezoidal rule?
    3. Why is the trapezoidal rule well suited for implementation on a computer?

    EXERCISES

    1. Estimate the value of the integral

      using the trapezoidal rule and the data given in Exercise 2 of the preceding Step.

    2. Use the trapezoidal rule with h = 1,0.5, and 0.25 to estimate the value of the integral

      .

      Answers

      last next